package cn.bas.core.exception;

import cn.bas.constants.ServiceExceptionEnum;

public class ServiceException extends RuntimeException {

    private final Integer code;

    public ServiceException(ServiceExceptionEnum serviceExceptionEnum){
        // 通过超类设置message
        super(serviceExceptionEnum.getMessage());
        // 设置状态码
        this.code=serviceExceptionEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }
}
